Processes
Tasks
-
Type the command below. Change it from foreground to a background job.
dd if=/dev/zero of-/dev/null
-
Run the command above for three more times as a background job immediately.
-
Display information about the current background jobs.
-
Change the niceness of one of the dd processes to '-5'.
-
Send a sigkill signal to top.
-
Terminate all dd processes from the command line.
Solution
1. Setting as a background job
Run the command in the foreground:
dd if=/dev/zero of=/dev/null
Suspend the command by pressing Ctrl+Z
. Move the suspended job to the background:
bg
2. Run as a background job
Run the command above for three more times as a background job immediately.
dd if=/dev/zero of=/dev/null &
dd if=/dev/zero of=/dev/null &
dd if=/dev/zero of=/dev/null &
3. Display job details
Display information about the current background jobs.
jobs
4. Set the niceness
Find the process ID (PID) of one of the dd
processes:
ps aux | grep dd
Change the niceness of the process to -5
(replace <PID>
with the actual PID):
sudo renice -5 -p <PID>
5. Kill a job
Send a sigkill signal to top. Run top
in the foreground:
top
Find the PID of the top
process from another terminal:
pgrep top
Send a SIGKILL
signal to the top
process (replace <PID>
with the actual PID):
kill -9 <PID>
6. Kill processes
Find all dd
process IDs:
pgrep dd
Terminate all dd
processes:
pkill dd